/*
 * Copyright (c) 2018.
 * http://www.ulabcare.com
 */

package com.mt.roll.passport.params;

import com.mt.roll.core.enums.AppTypeEnum;
import com.mt.roll.core.enums.UserTypeEnum;
import com.mt.roll.core.base.BaseParam;
import com.mt.roll.core.validator.constraints.Enum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

/**
 * @author jiff
 * @date 2018/11/13
 * @since 1.0
 */
@EqualsAndHashCode(callSuper = true)
@Data
@Builder
@ApiModel(value = "短信验证码登录请求对象", description = "用于短信验证码登录")
public class MobileLoginParam extends BaseParam {

    @ApiModelProperty(value = "应用类型：\n" +
            "1、\tpc\n" +
            "2、\tapp\n" +
            "3、\twechat\n" +
            "4、\tminiapp", required = true, example = "3")
    @NotNull(message = "用户类型不能为空")
    @Enum(message = "非法的应用类型", target = {AppTypeEnum.class})
    private int appType;

    @ApiModelProperty(value = "用户类型：\n" +
            "1、\tPC管理端\n" +
            "2、\t移动端", required = true, example = "1")
    @Enum(message = "非法的用户类型", target = {UserTypeEnum.class})
    @NotNull(message = "用户类型不能为空")
    private Integer userType;
    
    @ApiModelProperty(value = "手机号码", required = true, example = "13588441519")
    @NotBlank(message = "手机号码不能为空")
    @Pattern(regexp = "^1[3456789]\\d{9}$", message = "手机号码格式不正确")
    private String mobile;

    @ApiModelProperty(value = "短信验证码", required = true, example = "1234")
    @Length(min = 4, max = 4, message = "短信验证码长度为4位")
    private String smsCode;

    @ApiModelProperty(value = "微信APPID", required = false, example = "13588441519")
    private String wechatAppId;
    @ApiModelProperty(value = "微信OAuthCode，用户获取微信用户openid", required = false, example = "13588441519")
    private String oauthCode;
}
